package com.oxy.svc.util;

import java.util.Map;


public class SvcRegister {
	private static Map<String, Object> svcMap = null;
	
	public static Map<String, Object> getSvcMap() {
		return svcMap;
	}
	public static void setSvcMap(Map<String, Object> svcMap) {
		SvcRegister.svcMap = svcMap;
	}
	
	@SuppressWarnings("rawtypes")
	public Object getSvcByIfClass(Class interfaceClass) throws SvcNotFoundException {
		Object obj = svcMap.get(interfaceClass.getName());
		if(obj == null)
			throw new SvcNotFoundException("SVC ["+interfaceClass.getName()+"] not found! Please regist it in Spring config first.");

		return obj;
	}
}
